#include <iostream>
#include <queue>
using namespace std;

int main(){
	queue<int> q;
	int times = 0;
	int result[7] = {0};
	int b[7] = {0};
	int a[7][7];
	for(int i=0;i<7;i++){
		for(int j=0;j<7;j++){
			cin>>a[i][j];
		}
	}
	b[0] = 1;
	q.push(0);
	while(!q.empty()){
		int s = q.front();
		q.pop();
		result[times] = s;
		times++;
		
		for(int j=0; j<7; j++){
			if(a[s][j] && !b[j]){
				b[j] = 1;
				q.push(j);
			}
		}				
	}
	for(int i=0;i<7;i++){
		cout<<(result[i]+0);
		if(i != 6) cout<<"-";
	}
	return 0;
}

/*  test data 1
0 0 0 0 1 0 0
1 0 1 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 1 0 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
*/

/*  test data 2
0 1 0 0 1 0 0
1 0 1 0 1 0 0
0 1 0 1 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 1 0
1 0 0 0 1 0 1
0 0 0 0 0 1 0
*/


